Clean up dom0_vga_console_info structure for v3.0.3.
authorkfraser@localhost.localdomain <kfraser@localhost.localdomain>
Mon, 18 Sep 2006 17:17:54 +0000 (18:17 +0100)
committerkfraser@localhost.localdomain <kfraser@localhost.localdomain>
Mon, 18 Sep 2006 17:17:54 +0000 (18:17 +0100)
Signed-off-by: Keir Fraser <keir@xensource.com>
linux-2.6-xen-sparse/arch/i386/kernel/setup-xen.c
linux-2.6-xen-sparse/arch/ia64/dig/setup.c
linux-2.6-xen-sparse/arch/x86_64/kernel/setup-xen.c
linux-2.6-xen-sparse/drivers/xen/console/console.c
linux-2.6-xen-sparse/include/xen/xencons.h
xen/drivers/video/vga.c
xen/include/public/xen.h

index 3457e31c8c4de5ccb76737858309ad40def8ffcc..58b45a96cd98e2387f831c4ddbf55a74345cc040 100644 (file)
@@ -65,6 +65,7 @@
 #include <xen/interface/physdev.h>
 #include <xen/interface/memory.h>
 #include <xen/features.h>
+#include <xen/xencons.h>
 #include "setup_arch_pre.h"
 #include <bios_ebda.h>
 
@@ -1665,33 +1666,15 @@ void __init setup_arch(char **cmdline_p)
                screen_info.orig_video_cols = 80;
                screen_info.orig_video_ega_bx = 3;
                screen_info.orig_video_points = 16;
+               screen_info.orig_y = screen_info.orig_video_lines - 1;
                if (xen_start_info->console.dom0.info_size >=
                    sizeof(struct dom0_vga_console_info)) {
                        const struct dom0_vga_console_info *info =
                                (struct dom0_vga_console_info *)(
                                        (char *)xen_start_info +
                                        xen_start_info->console.dom0.info_off);
-                       screen_info.orig_video_mode = info->txt_mode;
-                       screen_info.orig_video_isVGA = info->video_type;
-                       screen_info.orig_video_lines = info->video_height;
-                       screen_info.orig_video_cols = info->video_width;
-                       screen_info.orig_video_points = info->txt_points;
-                       screen_info.lfb_width = info->video_width;
-                       screen_info.lfb_height = info->video_height;
-                       screen_info.lfb_depth = info->lfb_depth;
-                       screen_info.lfb_base = info->lfb_base;
-                       screen_info.lfb_size = info->lfb_size;
-                       screen_info.lfb_linelength = info->lfb_linelen;
-                       screen_info.red_size = info->red_size;
-                       screen_info.red_pos = info->red_pos;
-                       screen_info.green_size = info->green_size;
-                       screen_info.green_pos = info->green_pos;
-                       screen_info.blue_size = info->blue_size;
-                       screen_info.blue_pos = info->blue_pos;
-                       screen_info.rsvd_size = info->rsvd_size;
-                       screen_info.rsvd_pos = info->rsvd_pos;
+                       dom0_init_screen_info(info);
                }
-               screen_info.orig_y = screen_info.orig_video_lines - 1;
                xen_start_info->console.domU.mfn = 0;
                xen_start_info->console.domU.evtchn = 0;
        } else
index 90d6ab64fa106b0c32743bdb0c0ff6443ca8019f..7f3826991a5a60c13ae7c7777425d6e1dcbc11ac 100644 (file)
@@ -25,6 +25,8 @@
 #include <asm/machvec.h>
 #include <asm/system.h>
 
+#include <xen/xencons.h>
+
 void __init
 dig_setup (char **cmdline_p)
 {
@@ -78,27 +80,8 @@ dig_setup (char **cmdline_p)
                        (struct dom0_vga_console_info *)(
                                (char *)xen_start_info +
                                xen_start_info->console.dom0.info_off);
-               screen_info.orig_video_mode = info->txt_mode;
-               screen_info.orig_video_isVGA = info->video_type;
-               screen_info.orig_video_lines = info->video_height;
-               screen_info.orig_video_cols = info->video_width;
-               screen_info.orig_video_points = info->txt_points;
-               screen_info.lfb_width = info->video_width;
-               screen_info.lfb_height = info->video_height;
-               screen_info.lfb_depth = info->lfb_depth;
-               screen_info.lfb_base = info->lfb_base;
-               screen_info.lfb_size = info->lfb_size;
-               screen_info.lfb_linelength = info->lfb_linelen;
-               screen_info.red_size = info->red_size;
-               screen_info.red_pos = info->red_pos;
-               screen_info.green_size = info->green_size;
-               screen_info.green_pos = info->green_pos;
-               screen_info.blue_size = info->blue_size;
-               screen_info.blue_pos = info->blue_pos;
-               screen_info.rsvd_size = info->rsvd_size;
-               screen_info.rsvd_pos = info->rsvd_pos;
+               dom0_init_screen_info(info);
        }
-       screen_info.orig_y = screen_info.orig_video_lines - 1;
        xen_start_info->console.domU.mfn = 0;
        xen_start_info->console.domU.evtchn = 0;
 #endif
index 8fe13ee2b015ddcd111fea60150e21cc6bcf31d9..9ecb2bc00915d2afc4d7786911a026cd24f8429c 100644 (file)
@@ -74,6 +74,7 @@
 #include <asm/hypervisor.h>
 #include <xen/interface/nmi.h>
 #include <xen/features.h>
+#include <xen/xencons.h>
 #define PFN_UP(x)       (((x) + PAGE_SIZE-1) >> PAGE_SHIFT)
 #define PFN_PHYS(x)     ((x) << PAGE_SHIFT)
 #include <asm/mach-xen/setup_arch_post.h>
@@ -645,33 +646,15 @@ void __init setup_arch(char **cmdline_p)
                screen_info.orig_video_cols = 80;
                screen_info.orig_video_ega_bx = 3;
                screen_info.orig_video_points = 16;
+               screen_info.orig_y = screen_info.orig_video_lines - 1;
                if (xen_start_info->console.dom0.info_size >=
                    sizeof(struct dom0_vga_console_info)) {
                        const struct dom0_vga_console_info *info =
                                (struct dom0_vga_console_info *)(
                                        (char *)xen_start_info +
                                        xen_start_info->console.dom0.info_off);
-                       screen_info.orig_video_mode = info->txt_mode;
-                       screen_info.orig_video_isVGA = info->video_type;
-                       screen_info.orig_video_lines = info->video_height;
-                       screen_info.orig_video_cols = info->video_width;
-                       screen_info.orig_video_points = info->txt_points;
-                       screen_info.lfb_width = info->video_width;
-                       screen_info.lfb_height = info->video_height;
-                       screen_info.lfb_depth = info->lfb_depth;
-                       screen_info.lfb_base = info->lfb_base;
-                       screen_info.lfb_size = info->lfb_size;
-                       screen_info.lfb_linelength = info->lfb_linelen;
-                       screen_info.red_size = info->red_size;
-                       screen_info.red_pos = info->red_pos;
-                       screen_info.green_size = info->green_size;
-                       screen_info.green_pos = info->green_pos;
-                       screen_info.blue_size = info->blue_size;
-                       screen_info.blue_pos = info->blue_pos;
-                       screen_info.rsvd_size = info->rsvd_size;
-                       screen_info.rsvd_pos = info->rsvd_pos;
+                       dom0_init_screen_info(info);
                }
-               screen_info.orig_y = screen_info.orig_video_lines - 1;
                xen_start_info->console.domU.mfn = 0;
                xen_start_info->console.domU.evtchn = 0;
        } else
index a45d21a69c388b950826fb873538a252930b0c72..ff3e2a411e36667aafeab8bfeca4511af8a9ef8d 100644 (file)
@@ -49,6 +49,7 @@
 #include <linux/console.h>
 #include <linux/bootmem.h>
 #include <linux/sysrq.h>
+#include <linux/screen_info.h>
 #include <asm/io.h>
 #include <asm/irq.h>
 #include <asm/uaccess.h>
@@ -266,6 +267,41 @@ void xencons_force_flush(void)
 }
 
 
+void dom0_init_screen_info(const struct dom0_vga_console_info *info)
+{
+       switch (info->video_type) {
+       case XEN_VGATYPE_TEXT_MODE_3:
+               screen_info.orig_video_mode = 3;
+               screen_info.orig_video_ega_bx = 3;
+               screen_info.orig_video_isVGA = 1;
+               screen_info.orig_video_lines = info->u.text_mode_3.rows;
+               screen_info.orig_video_cols = info->u.text_mode_3.columns;
+               screen_info.orig_x = info->u.text_mode_3.cursor_x;
+               screen_info.orig_y = info->u.text_mode_3.cursor_y;
+               screen_info.orig_video_points =
+                       info->u.text_mode_3.font_height;
+               break;
+       case XEN_VGATYPE_VESA_LFB:
+               screen_info.orig_video_isVGA = VIDEO_TYPE_VLFB;
+               screen_info.lfb_width = info->u.vesa_lfb.width;
+               screen_info.lfb_height = info->u.vesa_lfb.height;
+               screen_info.lfb_depth = info->u.vesa_lfb.bits_per_pixel;
+               screen_info.lfb_base = info->u.vesa_lfb.lfb_base;
+               screen_info.lfb_size = info->u.vesa_lfb.lfb_size;
+               screen_info.lfb_linelength = info->u.vesa_lfb.bytes_per_line;
+               screen_info.red_size = info->u.vesa_lfb.red_size;
+               screen_info.red_pos = info->u.vesa_lfb.red_pos;
+               screen_info.green_size = info->u.vesa_lfb.green_size;
+               screen_info.green_pos = info->u.vesa_lfb.green_pos;
+               screen_info.blue_size = info->u.vesa_lfb.blue_size;
+               screen_info.blue_pos = info->u.vesa_lfb.blue_pos;
+               screen_info.rsvd_size = info->u.vesa_lfb.rsvd_size;
+               screen_info.rsvd_pos = info->u.vesa_lfb.rsvd_pos;
+               break;
+       }
+}
+
+
 /******************** User-space console driver (/dev/console) ************/
 
 #define DRV(_d)         (_d)
index fa2160d89d6ff7da9171d7acc51428cb61029176..ae873746aa5d121059270511cb2c3320c76fa1fa 100644 (file)
@@ -1,6 +1,9 @@
 #ifndef __ASM_XENCONS_H__
 #define __ASM_XENCONS_H__
 
+struct dom0_vga_console_info;
+void dom0_init_screen_info(const struct dom0_vga_console_info *info);
+
 void xencons_force_flush(void);
 void xencons_resume(void);
 
index 9355864ed7fe70b85448bbc9b186535f9c80d514..08a260a2b714291f366974d74a3bba8ff4b9decf 100644 (file)
@@ -680,11 +680,12 @@ int fill_console_start_info(struct dom0_vga_console_info *ci)
     if ( !vgacon_enabled )
         return 0;
 
-    ci->video_type   = 1;
-    ci->video_width  = COLUMNS;
-    ci->video_height = LINES;
-    ci->txt_mode     = 3;
-    ci->txt_points   = font ? font->height : 16;
+    ci->video_type = XEN_VGATYPE_TEXT_MODE_3;
+    ci->u.text_mode_3.rows     = LINES;
+    ci->u.text_mode_3.columns  = COLUMNS;
+    ci->u.text_mode_3.cursor_x = 0;
+    ci->u.text_mode_3.cursor_y = LINES - 1;
+    ci->u.text_mode_3.font_height = font ? font->height : 16;
 
     return 1;
 }
index bec06df60b6714f79c87613da7ba73255d75d121..dd56fc1cae34607437c5296a5d1609f805e3436d 100644 (file)
@@ -517,25 +517,37 @@ typedef struct start_info start_info_t;
 #define SIF_INITDOMAIN    (1<<1)  /* Is this the initial control domain? */
 
 typedef struct dom0_vga_console_info {
-    uint8_t video_type;
-    uint8_t txt_points;
-    uint16_t txt_mode;
-    uint16_t txt_x;
-    uint16_t txt_y;
-    uint16_t video_width;
-    uint16_t video_height;
-    uint16_t lfb_linelen;
-    uint16_t lfb_depth;
-    unsigned long lfb_base;
-    unsigned long lfb_size;
-    uint8_t red_pos;
-    uint8_t red_size;
-    uint8_t green_pos;
-    uint8_t green_size;
-    uint8_t blue_pos;
-    uint8_t blue_size;
-    uint8_t rsvd_pos;
-    uint8_t rsvd_size;
+    uint8_t video_type; /* DOM0_VGA_CONSOLE_??? */
+#define XEN_VGATYPE_TEXT_MODE_3 0x03
+#define XEN_VGATYPE_VESA_LFB    0x23
+
+    union {
+        struct {
+            /* Font height, in pixels. */
+            uint16_t font_height;
+            /* Cursor location (column, row). */
+            uint16_t cursor_x, cursor_y;
+            /* Number of rows and columns (dimensions in characters). */
+            uint16_t rows, columns;
+        } text_mode_3;
+
+        struct {
+            /* Width and height, in pixels. */
+            uint16_t width, height;
+            /* Bytes per scan line. */
+            uint16_t bytes_per_line;
+            /* Bits per pixel. */
+            uint16_t bits_per_pixel;
+            /* LFB physical address, and size (in units of 64kB). */
+            uint32_t lfb_base;
+            uint32_t lfb_size;
+            /* RGB mask offsets and sizes, as defined by VBE 1.2+ */
+            uint8_t  red_pos, red_size;
+            uint8_t  green_pos, green_size;
+            uint8_t  blue_pos, blue_size;
+            uint8_t  rsvd_pos, rsvd_size;
+        } vesa_lfb;
+    } u;
 } dom0_vga_console_info_t;
 
 typedef uint8_t xen_domain_handle_t[16];